<%@ page import ="java.sql.*" %>
<%
ResultSet rs;
    String userid = request.getParameter("uname");    
    String pwd = request.getParameter("pass");
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");
    Statement stm=conn.createStatement();
   
    rs = stm.executeQuery("select * from members where uname='" + userid + "' and pass='" + pwd + "'");
    if (rs.next()) {
        session.setAttribute("userid", userid);
        //out.println("welcome " + userid);
        //out.println("<a href='logout.jsp'>Log out</a>");
        response.sendRedirect("success.jsp");
    } else {
        out.println("Invalid password <a href='index.jsp'>try again</a>");
    }
%>
